﻿@{
    Layout = "_Layout2.cshtml";


    // TODO: VALIDATION OF FORMULAR
    if(IsPost)
    {

        var data = Request["date1"];
        
        Response.Redirect("Table.cshtml?ID=" + Request["ID"] + "&data=" + data);
    }
   

    var doctorID = Request["ID"];
    var db = Database.Open("Clinic");

    var query = "SELECT * FROM Appointment WHERE Doctor = @0";
    var singleQuery = "SELECT * FROM Doctor WHERE ID = @0";

    var appointments = db.Query(query, doctorID);
    var doctor = db.QuerySingle(singleQuery, doctorID);
	
	string workStart = doctor.WorkingTimeStart.Hour + ":" + doctor.WorkingTimeStart.Minute.ToString("00");
    string workStop = doctor.WorkingTimeStop.Hour + ":" + doctor.WorkingTimeStop.Minute.ToString("00");

    //workStart = doctor.WorkingTimeStart.Hour;
    //int workStop = doctor.WorkingTimeStop.Hour;
}


</br>

<article id="godziny">Doktor pracuje w godzinach od @workStart do @workStop</article>


<form name="example" method="post">
Wybierz planowany dzień wizyty</br>
<input type="text" name="date1" value="" size=25>
<a href="#"
   onClick="cal.select(document.forms['example'].date1,'anchor1','MM-dd-yyyy'); return false;"
   id="anchor1">Kliknij, aby otworzyć kalendarz</A>
</br><input type="submit" value="Dalej">
</form>


</br>

</br>
<a href="http://www.mattkruse.com/javascript/calendarpopup/">Developers reference: http://www.mattkruse.com/javascript/calendarpopup/</a>